<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>微信支付页</title>
    <link rel="icon" href="/img/favicon.ico">


    <link rel="stylesheet" type="text/css" href="/css/all.css" />
    <link rel="stylesheet" type="text/css" href="/css/pages-weixinpay.css" />
</head>

<body>
<div class="fl sao">
    <p class="red"></p>
    <div class="fl code">
        <div id="qrcode"></div>
        <div class="saosao">
            <p>请使用微信扫一扫</p>
            <p>扫描二维码支付</p>
        </div>
    </div>
    <div class="fl phone">

    </div>

</div>
</body>
<script src="/js/plugins/qrcode.min.js" ></script>
<script src="/js/plugins/stomp.min.js" ></script>
<script type="text/javascript" th:inline="javascript">
    let qrcode = new QRCode(document.getElementById("qrcode"), {
        width : 240,
        height : 240
    });
    qrcode.makeCode([[${code_url}]]);


    let client = Stomp.client('ws://127.0.0.1:15674/ws');
    let on_connect = function(x) {
        id = client.subscribe("/exchange/paynotify", function(d) {
            let orderId="11001021010312";//订单号
            if(d.body==orderId){
                location.href='/paysuccess.html?payMoney=1'; //参数支付金额
            }
        });
    };
    let on_error =  function() {
        console.log('error');
    };
    client.connect('webguest', 'itcast', on_connect, on_error, '/');


</script>

</html>